import type { ApiResponse, TableQuery } from '@/types/basetypes';
import type { TenantForm } from '@/types/tenant/types';
import type { QueryWrapper, UpdateWrapper } from '@/types/wrappertypes';
import request from '@/utils/request'

//查询部门列表信息
export function _getDepartmentList(params: object) {
  return request({
    url: '/tenant/query-all',
    method: 'GET',
    params: params,
  });
}

//查询部门信息
export const _getTenantInfo = async (params: { id: string }): Promise<ApiResponse<TenantForm>> => {
  const { id } = params;
  return request({
    url: `/tenant/query-details/${id}`,
    method: 'GET',
  });
}

//保存部门信息
export const _saveTenantInfo = async (params: object): Promise<ApiResponse<void>> => {
  return request({
    url: '/tenant/insert',
    method: 'POST',
    data: params,
  });
}

//更新部门信息
export const _modifyTenantInfo = async (params: UpdateWrapper): Promise<ApiResponse<void>> => {
  return request({
    url: '/tenant/modify',
    method: 'POST',
    data: params,
  });
}

// //删除部门信息
// export const _delTenantInfoByIds = async (ids: string): Promise<ApiResponse<void>> => {
//   return request({
//     url: '/tenant/del-ids',
//     method: 'POST',
//     data: { ids: ids },
//   });
// }


//查询部门列表操作数据
export const _getTenantTableList = async (params: QueryWrapper): Promise<ApiResponse<TableQuery<TenantForm>>> => {
  return request({
    url: `/tenant/query-table-list`,
    method: 'POST',
    data: params
  });
}



